package org.testis.gui.mvc.model.testdesign;

import org.testis.gui.mvc.model.*;
import org.testis.gui.mvc.controller.testdesign.LanguageVariablesController;
import org.testis.gui.mvc.utilities.AtofTableModel;
import javax.swing.table.DefaultTableModel;


/**
 *
 * @author nurhat
 */
public class LanguageVariablesModel extends AbstractModel
{

    private Integer m_languageId = 0;
    private String m_languageVariable;
    private Boolean m_viewVisibility = false;
    private String m_lastError;
    private AtofTableModel m_model;


    public LanguageVariablesModel()
    {
        super();
    }


    public LanguageVariablesModel(AtofTableModel model)
    {
        super();
        setModel(model);
    }


    public Integer getLanguageId()
    {
        return m_languageId;
    }


    public void setLanguageId(Integer val)
    {
        Integer oldValue = m_languageId;
        m_languageId = val;
        firePropertyChange(LanguageVariablesController.SELECT_LANGUAGE_ID,
                           oldValue,
                           m_languageId);
    }


    public String getLanguageVariable()
    {
        return m_languageVariable;
    }


    public void setLanguageVariable(String val)
    {
        String oldValue = m_languageVariable;
        m_languageVariable = val;
        firePropertyChange(LanguageVariablesController.SELECT_LANGUAGE_VARIABLE,
                           oldValue,
                           m_languageVariable);
    }


    public Boolean getViewVisibility()
    {
        return m_viewVisibility;
    }


    public void setViewVisibility(Boolean val)
    {
        boolean oldValue = m_viewVisibility;
        m_viewVisibility = val;
        firePropertyChange(LanguageVariablesController.SHOW_VIEW,
                           oldValue,
                           m_viewVisibility);
    }


    public String getLastError()
    {
        return m_lastError;
    }


    public void setLastError(String val)
    {
        String oldValue = m_lastError;
        m_lastError = val;
        firePropertyChange(LanguageVariablesController.SHOW_ERROR,
                           oldValue,
                           m_lastError);
    }


    public AtofTableModel getModel()
    {
        if (m_model == null) {
            setModel(new AtofTableModel());
        }
        return m_model;
    }


    public void setModel(AtofTableModel model)
    {

        AtofTableModel oldModel = m_model;
        m_model = model;
        firePropertyChange(
            LanguageVariablesController.PARAMETER_MODEL_CHANGED,
            oldModel,
            m_model);

    }
}
